prepare("select * from grain where productcode = $pcode" ) ; $getproduct->execute() ; while($row = $getproduct->fetch(pdo::FETCH_ASSOC) ) { if($row['measure'] == 'Cup') $percupx = $row['amount'] ; if($row['measure'] == 'Bag') $perbagx = $row['amount'] ; if($row['measure'] == 'Half Bag') $halfbagx = $row['amount'] ; if($row['measure'] == 'Penta Bucket') $perpentax = $row['amount'] ; if($row['measure'] == 'Half Penta') $halfpentax = $row['amount'] ; if($row['measure'] == 'Litre') $perliterx = $row['amount'] ; } //get product name $getproductn = $DB_con->prepare("select * from products where product_code = $pcode" ) ; $getproductn->execute() ; $rown = $getproductn->fetch(pdo::FETCH_ASSOC) ; $product = $rown['product_name'] ; $price = $rown['price'] ; //get details of the admin $st = $_SESSION['st'] ; $ctry = $_SESSION['ctry'] ; $city = $_SESSION['city'] ; if(!$_SESSION['rs'] ) { $rs = 'nill' ; } else { $rs = $_SESSION['rs'] ; } if(isset($_POST['submit'])) { if($getproduct->rowcount() > 0) { $icode = $pcode ; $bag = $_POST['bag']; $halfbag = $_POST['halfbag']; $penta = $_POST['penta']; $halfpenta = $_POST['halfpenta']; $liter = $_POST['liter']; $cup = $_POST['cup']; $mb = 'Bag' ; $mhb = 'Half Bag' ; $mp = 'Penta Bucket' ; $mhp = 'Half Penta' ; $mc = 'Cup' ; $ml = 'Liter' ; $stmt = $DB_con->prepare("update grain set amount = :c where (productcode =:a and measure =:b)") ; $stmt->bindparam(":a", $icode) ; $stmt->bindparam(":b", $mb) ; $stmt->bindparam(":c", $bag) ; $stmt->execute() ; $stmt1 = $DB_con->prepare("update grain set amount = :c where (productcode =:a and measure =:b)") ; $stmt1->bindparam(":a", $icode) ; $stmt1->bindparam(":b", $mhb) ; $stmt1->bindparam(":c", $halfbag) ; $stmt1->execute() ; $stmt2 = $DB_con->prepare("update grain set amount = :c where (productcode =:a and measure =:b)") ; $stmt2->bindparam(":a", $icode) ; $stmt2->bindparam(":b", $mp) ; $stmt2->bindparam(":c", $penta) ; $stmt2->execute(); $stmt3 = $DB_con->prepare("update grain set amount = :c where (productcode =:a and measure =:b)") ; $stmt3->bindparam(":a", $icode) ; $stmt3->bindparam(":b", $mhp) ; $stmt3->bindparam(":c", $halfpenta) ; $stmt3->execute(); $stmt4 = $DB_con->prepare("update grain set amount = :c where (productcode =:a and measure =:b)") ; $stmt4->bindparam(":a", $icode) ; $stmt4->bindparam(":b", $mc) ; $stmt4->bindparam(":c", $cup) ; $stmt4->execute(); $stmt5 = $DB_con->prepare("update grain set amount = :c where (productcode =:a and measure =:b)") ; $stmt5->bindparam(":a", $icode) ; $stmt5->bindparam(":b", $ml) ; $stmt5->bindparam(":c", $liter) ; $stmt5->execute(); header("location: home.php") ; } else { $icode = $pcode ; $bagm = $_POST['bag']; $bag = 'Bag' ; $halfbagm = $_POST['halfbag']; $halfbag = "Half Bag" ; $pentam = $_POST['penta']; $penta = 'Penta Bucket' ; $halfpentam = $_POST['halfpenta']; $halfpenta = "Half Penta" ; $literm = $_POST['liter']; $liter = 'Litre' ; $cupm = $_POST['cup']; $cup = "Cup" ; $stmt = $DB_con->prepare("insert into grain (measure,productcode,amount) values(:a,:b,:c)" ) ; $stmt->bindparam(":a", $bag) ; $stmt->bindparam(":b", $icode) ; $stmt->bindparam(":c", $bagm) ; $stmt->execute() ; $stmt2 = $DB_con->prepare("insert into grain (measure,productcode,amount) values(:a,:b,:c)" ) ; $stmt2->bindparam(":a", $halfbag) ; $stmt2->bindparam(":b", $icode) ; $stmt2->bindparam(":c", $halfbagm) ; $stmt2->execute() ; $stmt3 = $DB_con->prepare("insert into grain (measure,productcode,amount) values(:a,:b,:c)" ) ; $stmt3->bindparam(":a", $penta) ; $stmt3->bindparam(":b", $icode) ; $stmt3->bindparam(":c", $pentam) ; $stmt3->execute() ; $stmt4 = $DB_con->prepare("insert into grain (measure,productcode,amount) values(:a,:b,:c)" ) ; $stmt4->bindparam(":a", $halfpenta) ; $stmt4->bindparam(":b", $icode) ; $stmt4->bindparam(":c", $halfpentam) ; $stmt4->execute() ; $stmt5 = $DB_con->prepare("insert into grain (measure,productcode,amount) values(:a,:b,:c)" ) ; $stmt5->bindparam(":a", $liter) ; $stmt5->bindparam(":b", $icode) ; $stmt5->bindparam(":c", $literm) ; $stmt5->execute() ; $stmt6 = $DB_con->prepare("insert into grain (measure,productcode,amount) values(:a,:b,:c)" ) ; $stmt6->bindparam(":a", $cup) ; $stmt6->bindparam(":b", $icode) ; $stmt6->bindparam(":c", $cupm) ; $stmt6->execute() ; header("location: home.php") ; } } ?> Update

..Price Per Bag :